package org.third.spring.boot.hello.domain;

import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Parameter;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import java.io.Serializable;
//
//@Entity
//@Table(name = "HellFeature")
public class HelloFeature extends PersistObject {

	private static final long serialVersionUID = 5278682417893020522L;

	@Id
	@GeneratedValue(generator = "MyGenerator")
	@GenericGenerator(name = "MyGenerator", strategy = "foreign", parameters = @Parameter(value = "user", name = "property"))
	@Column(name = "user_id")
	private Long userId;

	@Column(name = "feature", nullable = false)
	@Lob
	private String feature;

	@OneToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
	@JoinColumn(name = "user_id")
	private HelloUser user;

	public Long getUserId() {
		return userId;
	}

	public void setUserId(Long userId) {
		this.userId = userId;
	}

	public HelloUser getUser() {
		return user;
	}

	public void setUser(HelloUser user) {
		this.user = user;
	}

	public String getFeature() {
		return feature;
	}

	public void setFeature(String feature) {
		this.feature = feature;
	}

}